﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class MenueItem : MonoBehaviour
{
    public int index = 0;
    private void Start()
    {
        this.gameObject.GetComponent<Button>().onClick.AddListener(Click);
    }

    public void SetData(int index)
    {
        string str = "";
        switch (index)
        {
            case 0:
                str = "设置";
                break;
            case 1:
                str = "角色";
                break;
            case 2:
                str = "挂机";
                break;
            case 3:
                str = "声音";
                break;
            case 4:
                str = "宠物";
                break;
            case 5:
                str = "坐骑";
                break;
            case 6:
                str = "分享";
                break;
            default:
                str = "其他";
                break;
        }
        this.GetComponentInChildren<Text>().text = str;
    }

    void Click()
    {
        Debug.Log(this.gameObject.name);
    }
   
}
